package com.liu.domain.base;

import java.io.Serializable;

/**
 * 返回对象信息
 *
 * @author LIU
 */
public class ObjectResult<T> extends BaseResult implements Serializable {
    /**
     * 对象
     */
    private T data;

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public ObjectResult() {

    }

    private ObjectResult(boolean success, String msg) {
        this.setSuccess(success);
        this.setMsg(msg);
    }

    private ObjectResult(boolean success, T data) {
        this.setSuccess(success);
        this.data = data;
    }

    public static ObjectResult error(String msg) {
        return new ObjectResult(false, msg);
    }

    public static <T> ObjectResult<T> success(T data) {
        return new ObjectResult<T>(true, data);
    }
}
